﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="MyFloridaHouse.SilverlightMassDataReport.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800">

    <!---->

    <Grid  x:Name="LayoutRoot" Margin="2"   Background="{StaticResource MainPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        
        <StackPanel  Grid.Row="0"  Orientation="Horizontal">
            <sdk:Label Content="Florida House of Representatives MyDistrictBuilder Report Builder"  Style="{StaticResource lblTitleStyle}" ></sdk:Label>
        </StackPanel>

        <StackPanel  Grid.Row="1"  Orientation="Horizontal">
            <StackPanel Orientation="Horizontal" Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertNotBoolToVisibility}}">
            <sdk:Label Content="(Loading ACS Data Definitions)"  Background="Yellow" Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertNotBoolToVisibility}}" ></sdk:Label>
                </StackPanel>
            <sdk:Label Content="(Getting File From Disk)"  Background="Yellow" Visibility="{Binding fileOpen.isFileLoading, Converter={StaticResource ConvertBoolToVisibility}}" ></sdk:Label>
        </StackPanel>

        <StackPanel Grid.Row="2"  Orientation="Horizontal"  Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertBoolToVisibility}}">

            <StackPanel Grid.Row="0" Grid.Column="0" >
            <Button Command="{Binding  CmdFileImportCloud}" Width="60" Height="55" HorizontalAlignment="Left" Margin="2" ToolTipService.ToolTip="Click to load district plan" >
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                    <sdk:Label Content=" Open"/>
                    <sdk:Label Content=" Cloud"/>
                    <sdk:Label Content=" File"/>
                    </StackPanel>
                </Button.Content>
            </Button>
                <!-- //TODO: add refresh capability to user doesn't have to go through the file/open interface again.  Just one click to reload -->
            <!--<Button Command="{Binding  CmdFileRead}" Width="60" Height="40" HorizontalAlignment="Left" Margin="2" ToolTipService.ToolTip="Click to load district plan" >
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                    <sdk:Label Content=" Refresh"/>
                    <sdk:Label Content=" Data"/>
                    </StackPanel>
                </Button.Content>
            </Button>-->
        </StackPanel>

        <StackPanel  Orientation="Vertical" HorizontalAlignment="Left" Margin="5">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Plan Name:"></TextBlock>
            <TextBlock Text="{Binding planName}" Margin="0,0,10,0"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Plan Type: "></TextBlock>
            <TextBlock Text="{Binding planType}" Margin="0,0,10,0"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Districts: "></TextBlock>
            <TextBlock Text="{Binding planDistrictCount}" Margin="0,0,10,0"></TextBlock>
            </StackPanel>
            <!--<StackPanel Orientation="Horizontal">
                <TextBlock Text="Last Updated: "></TextBlock>
                <TextBlock Text="{Binding planLastUpdateTimeStamp}"></TextBlock>
            </StackPanel>-->
        </StackPanel>
    </StackPanel>

    <Grid  Grid.Row="3" Grid.Column="0"  Visibility="{Binding isACSDefinitionLoadComplete, Converter={StaticResource ConvertBoolToVisibility}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
            <TextBlock  Text="ACS Data" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
            <Button  Content="Check All" Command="{Binding  CmdACSDistrictSummaryCheckAll}"  Height="20" Margin="2" ToolTipService.ToolTip="Click to check all ACS report sections" />
        </StackPanel>

        <StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Orientation="Horizontal" >
            <StackPanel Orientation="Horizontal">

                <sdk:Label Content=" District:"/>
                <ComboBox  Height="20" Width="80"  x:Name="cmbDistrict" ItemsSource="{Binding districtList}" SelectedIndex="{Binding districtSelectedIndex, Mode=TwoWay}" Tag="{Binding}"  >
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Border HorizontalAlignment="Stretch" >
                                <sdk:Label Content="{Binding}" Width="50" />
                            </Border>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <Button Content="Update" Command="{Binding  CmdACSDistrictSummary}" Width="75" Height="23" HorizontalAlignment="Left" Margin="2" ToolTipService.ToolTip="Click to run report for current selections"  />
                <!--<Button Content="Print" Command="{Binding  CmdFilePrint}" Width="75" Height="23" HorizontalAlignment="Left" Margin="2" ToolTipService.ToolTip="Click to print report "  />-->

            </StackPanel>

        </StackPanel>

        <sdk:TreeView Grid.Row="1" Grid.Column="0"  ItemsSource="{Binding ACSSubjectTree}" BorderThickness="2" Background="{StaticResource MainPageBackgroundBrush}" VerticalAlignment="Stretch"  Margin="2" Padding="0,0,15,0" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <sdk:TreeView.ItemTemplate>
                <sdk:HierarchicalDataTemplate ItemsSource="{Binding subList}">
                    <StackPanel Orientation="Horizontal" >
                        <CheckBox IsChecked="{Binding isSelected, Mode=TwoWay}" />
                        <TextBlock Text="{Binding name}" Tag="{Binding}"></TextBlock>
                    </StackPanel>
                </sdk:HierarchicalDataTemplate>
            </sdk:TreeView.ItemTemplate>
        </sdk:TreeView>




        <Border Grid.Row="1"  Grid.Column="1" BorderBrush="Black" BorderThickness="2" Margin="2" >
            <Grid Grid.Row="2"  Margin="2"  >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0" x:Name="ChildwindowStackpanel" ></StackPanel>
                <ListBox Grid.Row="1" Margin="0"   x:Name="appPrintArea"  ItemsSource="{Binding ACSDistrictSummaryReportSections}" 
                              Background="{StaticResource MainPageBackgroundBrush}"
                      ScrollViewer.HorizontalScrollBarVisibility="Auto"
                      ScrollViewer.VerticalScrollBarVisibility="Auto"
                        ItemTemplate="{StaticResource DataTemplateACSDistrictSummaryReport}"
                          
                      >
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Vertical"></StackPanel>
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>

                </ListBox>
            </Grid>
        </Border>
    </Grid>
    </Grid>


</UserControl>
